﻿
Namespace ViewModel
    Public Class FontFamilyListItemViewModel
        Inherits ViewModelBase



        Public Sub New(ByVal familyFamily As System.Windows.Media.FontFamily)
            _fontFamily = familyFamily
            _displayName = NameDictionaryHelper.GetDisplayName(_fontFamily.FamilyNames)
        End Sub

        Private _displayName As String
        Public ReadOnly Property Name() As String
            Get
                Return _displayName
            End Get
        End Property

        Private _fontFamily As System.Windows.Media.FontFamily
        Public ReadOnly Property FontFamily() As System.Windows.Media.FontFamily
            Get
                Return _fontFamily
            End Get
        End Property

        Public Overrides Function ToString() As String
            Return _displayName
        End Function

        Public ReadOnly Property IsSymbolFont() As Boolean
            Get
                For Each typeface As Typeface In FontFamily.GetTypefaces()
                    Dim face As GlyphTypeface = Nothing
                    If typeface.TryGetGlyphTypeface(face) Then
                        Return face.Symbol
                    End If
                Next
                Return False
            End Get
        End Property
    End Class

End Namespace
